package com.lagou.clone;

import java.util.Arrays;

/**
 * @author: lidy
 * @date: 2021/10/9 13:57
 */
public class ArraysCopyExample {

    public static void main(String[] args) {
        People[] o1 = {new People(1, "Java")};
        People[] o2 = Arrays.copyOf(o1, o1.length);

        // 修改原型对象的第一个元素的值
        o1[0].setName("Jdk");
        System.out.println("o1:" + o1[0].getName());
        System.out.println("o2:" + o2[0].getName());
    }
}
